package com.ethanhua.skeleton;

import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.FrameLayout;

import androidx.constraintlayout.widget.ConstraintLayout;
import androidx.recyclerview.widget.RecyclerView;

import com.facebook.shimmer.ShimmerFrameLayout;

/**
 * Created by ethanhua on 2017/7/29.
 */

public class ShimmerViewHolder extends RecyclerView.ViewHolder {

    ShimmerFrameLayout shimmerViewContainer;

    public ShimmerViewHolder(LayoutInflater inflater, ViewGroup parent, int innerViewResId) {
        super(inflater.inflate(R.layout.layout_shimmer, parent, false));
        shimmerViewContainer = itemView.findViewById(R.id.shimmer_view_container);

        FrameLayout layout = itemView.findViewById(R.id.content);

        View view = inflater.inflate(innerViewResId, layout, false);
        layout.setLayoutParams(new ConstraintLayout.LayoutParams(view.getLayoutParams()));
        layout.addView(view);
    }
}
